﻿@inject CounterState CounterState
@implements IDisposable

<ContentPage>
    <StackLayout>

        <StackLayout Margin="20" Spacing="10" Orientation="StackOrientation.Horizontal">
            <Label Text="@($"Hello, World! {CounterState.CurrentCount}")" FontSize="30" />
            <Button Text="Increment" OnClick="@CounterState.IncrementCount" VerticalOptions="LayoutOptions.Center" Padding="10" />
        </StackLayout>

        <BlazorWebView HostPage="wwwroot/index.html">
            <RootComponents>
                <RootComponent Selector="#app" ComponentType="typeof(NewApp.WebUI.App) "/>
            </RootComponents>
        </BlazorWebView>

    </StackLayout>
</ContentPage>


@code {
    protected override void OnInitialized()
    {
        CounterState.StateChanged += StateHasChanged;
    }

    public void Dispose()
    {
        CounterState.StateChanged -= StateHasChanged;
    }
}